﻿#include <QApplication>
#include "routine/global.h"
#include "ui/bridge/html_bridge.h"

cls_bridge* 	g_viewer	= NULL;

/**
 *	main
 *
 *	@argc		[in] the command line arguments count
 *	@argv		[in] the command line arguments array
 *
 *	return
 * 		exit code
 */
int main( int argc, char *argv[] )
{
    QApplication 	app( argc, argv );

    pem_error_t		res;
    g_viewer		= new cls_bridge;
    if ( NULL == g_viewer ) { res = -1; goto EXIT; }

    // routine initialize
    res = routine_start( argc, argv );
    IF_GOTO( PEM_OK != res, EXIT );

    // ui initialize
    res = g_viewer->instance();
    IF_GOTO( PEM_OK != res, EXIT );
    g_viewer->show();

    res = app.exec();

EXIT:
    routine_stop();
    if ( g_viewer ) {delete g_viewer; g_viewer = NULL;}

    return res;
}
